package cn.kgc.airquality.controller;

import cn.kgc.airquality.pojo.District;
import cn.kgc.airquality.pojo.Quality;
import cn.kgc.airquality.pojo.ResultEntity;
import cn.kgc.airquality.service.QualityService;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class QualityController {
    @Resource
    QualityService qualityService;

    @RequestMapping("/selectQuality")
    public ResultEntity<PageInfo<Quality>> selectQuality(@RequestParam(value = "pageNum",defaultValue = "1")
                                                                     Integer pageNum,
                                                         @RequestParam(value = "districtid",defaultValue = "0")
                                                                 Integer districtid){
        PageInfo<Quality> pageInfo = qualityService.selectAll(pageNum, districtid);
        return ResultEntity.successWithoutData(pageInfo);
    }
    @RequestMapping("/getDistrictList")
    public ResultEntity<List<District>> getDistrictList(){
        List<District> list = qualityService.selectAllv();
        return ResultEntity.successWithoutData(list);
    }
}
